FROM python:3.11-slim

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
    libgl1-mesa-glx \
    libjemalloc-dev \
    vim \
    git

RUN useradd -m -s /bin/bash user && \
    mkdir -p /home/user && \
    chown -R user /home/user/

WORKDIR /home/user/
RUN git clone https://atomgit.com/opea/000044 as smartwriting
WORKDIR /home/user/smartwriting

RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r /home/user/smartwriting/requirements.txt

COPY ./smartwriting.py /home/user/smartwriting.py

ENV PYTHONPATH=$PYTHONPATH:/home/user/smartwriting

USER user

WORKDIR /home/user

ENTRYPOINT ["python", "smartwriting.py"]
